﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EntityFrameworkDemo.Models
{

    public class ApplicationDbInitializer
        : DropCreateDatabaseAlways<ApplicationDbContext>
    {

        protected override void Seed(ApplicationDbContext context)
        {
            Console.WriteLine("Seeding the database...");

            for (int i = 0; i < 10; i++)
            {
                context.Records.Add(new RecordModel()
                {
                    Name = "Person_" + i.ToString(),
                    Date = DateTime.Now.AddDays(i),
                    IsAttend = i % 2 == 0
                });
            }

            base.Seed(context);
        }

    }

}